<div class="row">
 <small>
 <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
  </div> 
  <div class="span9">
   <div class="clearfix txtleft search span9" style="background-color:#f8f8f8; padding:10px; margin:10px 0px;"> 
      <form action="/<*$controller*>/orderlist" method="get"   name="form1" class="form-horizontal">       
		  <select id="jigou" name="groups"  oncha nge="getSchool(this.value)"></select>
          <select id="school" name="school"  onch ange="getClass(this.value)"></select> 
          <select id="class1" name="class"   ></select>  
          <input type="text" name="cnname" id="cnname"   placeholder="请输入要搜索的学生姓名"  value="<*$cnname*>"  />
         <input type="submit" class="btn btn-success"  value="查询"  >
         <input type="button" class="btn btn-success" value="清空查询" onclick="window.location='/<*$controller*>/orderlist'" >
      </form>
	</div>	 
    <*if $result|@count neq 0*>  
       <table class="table table-condensed table-bordered table-hover span9">  
        <tr class="success">   
           <td><strong>名称</strong></td>
           <td><strong>购买服务</strong></td>
           <td><strong>购买个数</strong></td> 
           <td><strong>单价</strong></td> 
           <td><strong>折扣</strong></td> 
           <td><strong>总价</strong></td> 
           <td><strong>实际消费</strong></td> 
           <td><strong>时间</strong></td> 
           <td><strong>生效时间</strong></td> 
           <td><strong>结束时间</strong></td>  
           <td><strong>详细</strong></td> 
        </tr>   
      <*foreach from=$result item=a key =key name=foo*> 
            <tr>
               <td class="span1"><*$a.cnname*></td>
               <td class="span1"><*if $a.ordertype eq 'base'*>基础服务<*else if $a.ordertype eq 'album'*>相册购买<*else if $a.ordertype eq 'courseware'*>课件下载<*else*>其他<*/if*></td>
               <td class="span1"><strong><*$a.paynum*></strong></td> 
               <td class="span1"><*$a.price*></td>
               <td class="span1"><*$a.discount*></td> 
               <td class="span1"><*$a.totalprice*></td>  
               <td class="span1"><*$a.trueprice*></td>  
               <td class="span1"><*$a.addtime|date_format:'%Y-%m-%d %H:%M:%S'*></td>  
               <td class="span1"><*if $a.effecttime*><*$a.effecttime|date_format:'%Y-%m-%d %H:%M:%S'*><*/if*></td>  
               <td class="span1"><*if $a.endtime*><*$a.endtime|date_format:'%Y-%m-%d %H:%M:%S'*><*/if*></td> 
               <td class="span1">
               <a style="cursor:pointer" onClick="orderdetail('<*$a.orderid*>','<*$a.cnname*>')" >
                  <i class="icon-list-alt"></i>
               </a>
               </td>  
            </tr>
             
           <*/foreach*> 
           <tr>
           <td colspan="11"> 
             <*$page*>
          </td>
         </tr> 
      </table>
      <*else*>  
          没有订单！   
        <*/if*>  
    </div>
    </small>  
   
  
<script type="text/javascript">   
       function   ajax_post(){ 
	    var groupsid="<*$groups*>"; 
        $.post("/<*$controller*>/groups/",{"jigouid":groupsid},function(data,statusText){ 
			 $("#jigou").append(data); 
        });  
	 } 
	  
	  $("#jigou").change(function(){
           // $("#city option:gt(0)").remove();  //清空所有城市的信息
            //$("#county option:gt(0)").remove();  //清空所有县级的信息
            var id = this.value;
			var schoolid="<*$schoolid*>";  
			  
            $.post("/<*$controller*>/schoollist/",{"id":id,"sid":schoolid},function(data,statusText){
                 $("#school").html('');
                 $("#school").append(data);
            
            });
        });
		
		$("#school").change(function(){
           // $("#city option:gt(0)").remove();  //清空所有城市的信息
            //$("#county option:gt(0)").remove();  //清空所有县级的信息
            var sid = this.value; 
            $.post("/<*$controller*>/classlist/",{"id":sid},function(data,statusText){
				 
                 $("#class1").html('');
                 $("#class1").append(data);
            
            });
        });
		
	
	 window.onload=function(){
	    ajax_post(); 
	 if( '<*$groups*>'+0 != 0 ){ 
	        
			var id = '<*$groups*>'; 
			var sid = '<*$schoolid*>';  
			 
			$.post("/<*$controller*>/schoollist/",{"id":id,"sid":sid},function(data,statusText){
				 $("#school").html('');
				 $("#school").append(data); 
				});
	    } 
          
	 if('<*$schoolid*>'+0 != 0){   
		   var id = '<*$schoolid*>'; 
		   var cid='<*$classid*>';
			$.post("/<*$controller*>/classlist/",{"id":id,"cid":cid},function(data,statusText){ 
				 $("#class1").html('');
				 $("#class1").append(data); 
				}); 
		   
	 }/* */

 } 
	 function orderdetail(id,name){
	   window.location='/<*$controller*>/orderdetail/orderid/'+id+'/name/'+name;   
	   } 


  /*
   window.onload=function(){
	 jigou(); 

	if('<*$groups*>' != ''){
		getSchool('<*$groups*>');
	}
	if('<*$school_id*>' != ''){
		getClass('<*$school_id*>','<*$groups*>');
	}

 } 
function jigou()
{  

	var url     = '/<*$controller*>/groups/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '';
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_course});

} 
function showResponse_course(originalRequest)
{
	{  //alert(originalRequest.responseText);  
		 document.all.form1.groups.innerHTML='<option value="0" >==请选择机构==</option>'+originalRequest.responseText;
		  if('<*$groups*>' != ''){
			 jsSelectIsExitItem(document.all.form1.groups,'<*$groups*>');
	        } 
	 }

}  

function getSchool(a)
{  
	var url  = '/<*$controller*>/schoollist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_school});

} 
function showResponse_school(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.school.innerHTML='<option value="0" >==请选择校区==</option>'+originalRequest.responseText;
		  if('<*$school_id*>' != ''){
				jsSelectIsExitItem(document.all.form1.school,'<*$school_id*>');
			}
	 } 
}  
function getClass(a)
{  
     
	var url  = '/<*$controller*>/classlist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	 
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_class});

} 
function showResponse_class(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.class.innerHTML='<option value="0" >==请选择班级==</option>'+originalRequest.responseText;
		  if('<*$classid*>' != ''){
				jsSelectIsExitItem(document.all.form1.class,'<*$classid*>');
			}
	 } 
}  

function deleteit(stuid,cid,groupid,schoolid,classid)
{
  if(confirm("删除将不能恢复")){
   window.location='/<*$controller*>/delete/stuid/'+stuid+'/cid/'+cid+'/groupid/'+groupid+'/schoolid/'+schoolid+'/classid/'+classid;
   }
} 
 
 
 function jsSelectIsExitItem(objSelect, objItemValue) {
	//alert(objSelect.options.length);
    for (var i = 0; i < objSelect.options.length; i++) {
        if (objSelect.options[i].value == objItemValue) { 
			objSelect.options[i].selected=true;
        	 break;
        }
    }
    return 1;
}  
 
 function addit(id){
	$(document).ready(function(){
	 //  $(".addnew").click(function(){ // Click to only happen on announce links
		 $("#account").val(id);
		 $('#myModal').modal('show');
	  // });
	});
				
} */
 
</script>
  
 </div> 